package cn.elead.chaos.framework.web.global.cors;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.HandlerInterceptor;

/**
 * 向服务器端查看是否有请求权限
 * <p>
 * 跨域请求时候首先通过 OPTIONS 方法和请求头中的 Access-Control-Request-Method
 * 属性向服务器端查看是否有请求权限，如果有权限才能继续请求到数据
 * 
 * @author luopeng
 *
 */
@Deprecated
public class OptionsInterceptor implements HandlerInterceptor {

	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {
		if (request.getMethod().equals("OPTIONS")) {
			response.setStatus(HttpServletResponse.SC_OK);
			return false;
		}
		return true;
	}

}
